package sugarbind_input

class Agent_Property {

    String agent_Property_Value
	Agent_Property agent_Property_Parent
	
	
    static constraints = {
			agent_Property_Value(blank:false)
			agent_Property_Parent(nullable:true)
			
			agent_Property_Value(unique:['agent_Property_Type'])
	}
	
	static hasOne = [agent_Property_Type:Agent_Property_Type]
	static hasMany = [agents:Agent]
	static belongsTo = [Agent]
	
	static mapping = {
//		id column: 'agent_property_id'
		id generator: 'sequence', params: [sequence: 'agent_property_id_seq']		
		
		agents joinTable: [name: "agent_agent_property", key: 'agent_property_id']
	}
	
	public String toString(){
		agent_Property_Type.agent_Property_Type_Name + " : " + agent_Property_Value //+" ("+ agent_Property_Type.agent_Property_Type_Name+")"
	}
}
